#!/usr/bin/env bash

echo "Broadcasting..."
TX=0x7B227061796C6F6164223A5B7B2274797065223A226469642F416464446964222C2276616C7565223A7B22646964446F63223A7B22646964223A226469643A736F763A51646F4E6F357456675748774D6B62525356705A5466222C227075624B6579223A2244743867477A757356547A3474724B596F716736775A536A37703676786D58584C56766A6F6A397754614375222C2263726564656E7469616C73223A5B5D7D7D7D5D2C227369676E617475726573223A5B7B227369676E617475726556616C7565223A2257596F6D6B7633385456315157586E6443426463686578304563414B366B4132684A33652B6533684A68596D3977732F566B70426134474A2F7873563943544B7147676E41334A454B634B71744D4661744B726D44673D3D222C2263726561746564223A22323032302D30342D32315431363A35313A30372E3734355A227D5D7D
curl -X GET localhost:26657/broadcast_tx_commit?tx=$TX

echo ""

echo "Now we can query the DID..."
ixocli q did getDidDoc did:sov:QdoNo5tVgWHwMkbRSVpZTf

# Decoded transaction (what we're actually broadcasting):
# {
#   "payload": [
#     {
#       "type": "did/AddDid",
#       "value": {
#         "didDoc": {
#           "did": "did:sov:QdoNo5tVgWHwMkbRSVpZTf",
#           "pubKey": "Dt8gGzusVTz4trKYoqg6wZSj7p6vxmXXLVvjoj9wTaCu",
#           "credentials": []
#         }
#       }
#     }
#   ],
#   "signatures": [
#     {
#       "signatureValue": "WYomkv38TV1QWXndCBdchex0EcAK6kA2hJ3e+e3hJhYm9ws/VkpBa4GJ/xsV9CTKqGgnA3JEKcKqtMFatKrmDg==",
#       "created": "2020-04-21T16:51:07.745Z"
#     }
#   ]
# }
